<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="com.tangdi.production.mpapp.utils.WebPayServletUtil"
	%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("on_back", "1");
	
	WebPayServletUtil payUtil = new WebPayServletUtil();
	
	boolean ok = payUtil.validation(request,response);
	if(!ok){
		payUtil.toLoginPage(request, response);
	}

	request.setAttribute("title", "绑定推荐人");
%>
<!DOCTYPE html>
<html lang="zh">
<base href="<%=basePath%>">
<head>
<title>商户激活</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta name="description" content="Common form elements and layouts" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<script type="text/javascript" src="js/jquery-1.7.1.min.js"
	charset="UTF-8"></script>

<script type="text/javascript" src="js/core-1.0.js" charset="UTF-8"></script>
<script type="text/javascript" src="js/webpay/base.js" charset="UTF-8"></script>
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="ace_v1.3/assets/css/bootstrap.css" />

<link rel="stylesheet" href="ace_v1.3/assets/css/chosen.css" />
<link rel="stylesheet" href="ace_v1.3/assets/css/font-awesome.css" />

<!-- text fonts -->
<link rel="stylesheet" href="ace_v1.3/assets/css/ace-fonts.css" />

<!-- ace styles -->
<link rel="stylesheet" href="ace_v1.3/assets/css/ace.css"
	class="ace-main-stylesheet" id="main-ace-style" />

<!--[if lte IE 9]>
			<link rel="stylesheet" href="ace_v1.3/assets/css/ace-part2.css" class="ace-main-stylesheet" />
		<![endif]-->

<!--[if lte IE 9]>
		  <link rel="stylesheet" href="ace_v1.3/assets/css/ace-ie.css" />
		<![endif]-->



<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

<!--[if lte IE 8]>
		<script src="ace_v1.3/assets/js/html5shiv.js"></script>
		<script src="ace_v1.3/assets/js/respond.js"></script>
		<![endif]-->
<jsp:include page="../plug/head-include.jsp" />
<style type="text/css">
</style>
<script type="text/javascript">
	function activatesSubmit(form){
		var r = confirm("推荐关系一经确认不可更改，您确定填写的推荐人信息正确并且绑定吗？");
		if(r){
			if(validateCallback(form,activatesSuccess)){
				doBtn($("button[type='submit']"),0);
			}
		}
		return false;
	}
	function activatesSuccess(json){
		if(codeSuccess(json)){
			alert(json["RSPMSG"]);
			//openUrl(BASE_PATH + "kdpay/createOrder.jsp?scene=05");
			//openUrl(BASE_PATH + "kdpay/index.jsp");
			toIndexPage();
		}else{
			alert(json["RSPMSG"]);
		}
		doBtn($("button[type='submit']"),1);
	}
</script>
</head>
<body class="no-skin">
	<!-- #section:basics/navbar.layout -->
	<jsp:include page="../plug/title.jsp" />

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">

		<!-- #section:basics/sidebar -->
		<!-- /section:basics/sidebar -->
		<div class="main-content">
			<div class="main-content-inner">
				<!-- #section:basics/content.breadcrumbs -->
				<!-- /section:basics/content.breadcrumbs -->
				<div class="page-content">
					<!-- #section:settings.box -->
					<!-- <div class="page-header">
						<h1>
							Form Elements <small> <i
								class="ace-icon fa fa-angle-double-right"></i> Common form
								elements and layouts
							</small>
						</h1>
					</div>
					 -->
					 <div class="space-1"></div>
					<div class="row">
						<div class="col-xs-12">
							<!-- PAGE CONTENT BEGINS -->
							<form class="form-horizontal" method="post" action="userActivates.web"
								role="form"
								onsubmit="return activatesSubmit(this)">

								<div class="form-group">
									<div class="col-sm-8 col-xs-12 col-sm-offset-2">
										<input type="text" name="referrer" validate="true"
											placeholder="请输入推荐人手机号" class="form-control" />
										<button type="button"
											class="btn btn_get_aciivates"
											style="width: 115px;height: 25px;margin-top: 5px;margin-left: 10px;display: none;" onclick="defaultAciivates()">没有推荐人?</button>
									</div>
								</div>
								
								<div class="space-1"></div>

								<div
									class="clearfix menu-btn-box col-sm-8 col-xs-12 col-sm-offset-2">
									
									<div class="col-sm-6 col-xs-6">
										<button class="btn btn-info btn-block" type="button"
											onclick="toIndexPage()">
											暂不绑定
										</button>
									</div>
									
									<div class="col-sm-6 col-xs-6">
										<button class="btn btn-info  btn-block" type="submit"
											>
											绑定
										</button>
									</div>
									
								</div>
							</form>
							<!-- /.col -->
						</div>
						<!-- /.row -->
					</div>

					<!-- /.page-header -->
				</div>
				<!-- /.page-content -->
			</div>
		</div>
		<!-- /.main-content -->

		<!-- /.main-container -->
	</div>
	<script type="text/javascript">
		//初始化推荐人
		var r = $.getCookie("_r");
		if(r){
			$("input[name='referrer']").val(r);
		}else{
			//$("input[name='TER_ACTION']").val("H4OHPTGPZ4");//默认公司激活码
			$("input[name='referrer']").attr({
				"placeholder":"填写推荐人手机号",
				"class":"col-xs-6 col-sm-8"
			});
			$(".btn_get_aciivates").show();
		}
		function defaultAciivates(){
			var msg = "请联系分享者获取激活码！";
			//alert(msg);
			var r = confirm("如果您有推荐人,请输入推荐人手机号(或合作商编号),如若没有系统可以给您提供默认激活码，推荐关系一经确认不可更改，您确定要获取默认激活码吗？");
			if(r){
				$("input[name='referrer']").val("8160800155");//默认公司激活码(默认合作商编号)
			}
		}
	</script>
	<script type="text/javascript" src="ace_v1.3/assets/js/jquery.maskedinput.js" charset="UTF-8"></script>
	<script type="text/javascript" src="js/jquery.tips.js" charset="UTF-8"></script>
	<!-- <script type="text/javascript" src="js/webpay/dial.js" charset="UTF-8"></script>
 -->
	<!-- basic scripts -->
</body>
</html>